package com.ztjy.sys.dao;

import com.ztjy.bean.Module;
import com.ztjy.bean.Permission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface PermissionDao {
    int deleteByPrimaryKey(Integer comid);

    int insert(Permission record);

    /**
     * 根据职位获取 其模块
     *
     * @param jobId
     * @param stateId
     * @param flag    1 一级模块 2 二级模块
     * @return
     */
    List<Module> findMoudleByJob(@Param("jobId") Integer jobId, @Param("stateId") Integer stateId, @Param("flag") Integer flag);

    /**
     * 查询原有的主见id
     *
     * @param jobId
     * @return
     */
    List<Integer> findPids(@Param("jobId") Integer jobId);

    int insertSelective(Permission record);

    Permission selectByPrimaryKey(Integer comid);

    int updateByPrimaryKeySelective(Permission record);

    int updateByPrimaryKey(Permission record);

    /**
     * 批量添加权限
     *
     * @param plist
     * @return
     */
    boolean inserPermissionList(@Param("plist") List<Permission> plist);

    /**
     * 根据id实现批量删除
     *
     * @param ids
     * @return
     */
    boolean deletePermissionAllById(@Param("ids") List<Integer> ids);
}